<?php

namespace catchAdmin\pc\controller;

use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\pc\model\SysLabel as SysLabelModel;
use think\Response;

class SysLabel extends CatchController
{

    protected $sysLabelModel;


    /**
     *
     * @time 2025/08/30 11:02
     * @param SysLabelModel $sysLabelModel
     * @return mixed
     */
    public function __construct(SysLabelModel $sysLabelModel)
    {
        $this->sysLabelModel = $sysLabelModel;
    }


    /**
     *
     * @time 2025/08/30 11:02
     * @return Response
     */
    public function index(Request $request): Response
    {
        return CatchResponse::successPcList($this->sysLabelModel->indexData($request->param()));
    }


    /**
     *
     * @time 2025/08/30 11:02
     * @param Request $request
     * @return Response
     */
    public function save(Request $request): Response
    {
        return CatchResponse::success($this->sysLabelModel->storeBy($request->post()));
    }


    /**
     *
     * @time 2025/08/30 11:02
     * @param $id
     * @return Response
     */
    public function read($id): Response
    {
        return CatchResponse::success($this->sysLabelModel->findBy($id));
    }


    /**
     *
     * @time 2025/08/30 11:02
     * @param $id
     * @param Request $request
     * @return Response
     */
    public function update($id, Request $request): Response
    {
        return CatchResponse::success($this->sysLabelModel->updateBy($id, $request->post()));
    }


    /**
     *
     * @time 2025/08/30 11:02
     * @param $id
     * @return Response
     */
    public function delete($id): Response
    {
        return CatchResponse::success($this->sysLabelModel->deleteBy($id));
    }
}
